<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>绑定样式</title>
    <script type="text/javascript" src="../js/vue.js"></script>
    <style>
        *{
            margin-top: 20px;
        }
        .basic{
            height: 100px;
            width: 500px;
            border: 2px solid;
            border-color: black;
        }
        .happy{
            background-color: pink;
        }
        .crazy{
            background-color: orangered;
        }
        .normal{
            background-color: aqua;
        }
        .circle{
            border-radius: 20px;
        }
    </style>
</head>
<body>
    <h2>条件渲染</h2>
    <p>v-show: 只是display 的修改（适用于修改频率比较高的情况）</p>
    <div id="root" class="basic circle" :class="styleChange" @click="choose">
        <p v-show="isShow">今天天气很：{{isHot}}</p>
        <p v-if="true"> v- if(可以结合 template 使用): 结构的是否展示，为false则不会出现该标签</p>
    </div>
    <p>v-if & v-else-if & v-else</p>


    <script type="text/javascript">
        const vm = new Vue({
            el: "#root",
            data() {
                return {
                    isHot: '超级超级热呀，你怎么敢的呀',
                    styleChange: 'normal',
                    isShow: true
                }
            },
            methods: {
                choose(){
                    const mod = ['happy', 'crazy', 'normal']
                    var index = Math.floor(Math.random()*3) 
                    console.log(index)
                    this.styleChange = mod[index]
                    console.log("isHot 被修改：",mod[index])
                }
            }
        })
        // vm.$watch('tag', { options })
        </script>
</body>
</html>